package cn.javaeye.lonlysky.lforum.entity.web;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;


@Entity
@Table(name = "t_fathertype")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class FartherType implements java.io.Serializable {

	private static final long serialVersionUID = -4054529705771332796L;
	private Integer id;
	private String name;
	/**
	 * 0代表跳蚤市场
	 * 1代表新闻板块
	 * 
	 */
	private String type;
	private Set<ParentType> parentType = new HashSet<ParentType>(0);
	@Id
	@GeneratedValue(generator = "paymentableGenerator")
	@GenericGenerator(name = "paymentableGenerator", strategy = "increment")
	@Column(name = "id", unique = true, nullable = false, insertable = true, updatable = true)
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(name = "name", unique = false, nullable = false, insertable = true, updatable = true, length = 60)
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "fartherType")
	public Set<ParentType> getParentType() {
		return parentType;
	}
	public void setParentType(Set<ParentType> parentType) {
		this.parentType = parentType;
	}

	@Column(name = "type", unique = false, nullable = false, insertable = true, updatable = true, length = 2)
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
}
